package ch05;

/**
 * Created by hasee on 2017/6/18.
 */
public class Coin {
    private final int HEADS= 0;
    private int face;
    public Coin()
    {
        flip();
    }
    public void flip()
    {face=(int)(Math.random()*2);}
    public boolean isHeads()
    {return (face == HEADS);}
    public String toString()
    {return (face==HEADS)?"Heads":"Tails";}
}
